// 客户端配置
export const socket = io('wss://211.87.232.122:8000', {
  // path:'/socket.io',
  transports: ['websocket', 'polling'],
  reconnection: true,             // 启用自动重连
  reconnectionAttempts: Infinity, // 无限次尝试
  reconnectionDelay: 1000,        // 初始延迟
  reconnectionDelayMax: 5000,     // 最大延迟
  randomizationFactor: 0.5,       // 延迟随机因子
  timeout: 10000,                 // 连接超时时间
  pingInterval: 25000,            // 发送心跳间隔
  pingTimeout: 5000               // 心跳超时时间
});

console.log("socket wanna to connect");
socket.on('connect',(data)=>{
    console.log("websocket 连接成功！");
})
socket.on('simulation_disconnect', (reason) => {
  console.log('断开连接:', reason);
});

socket.on('reconnect', (attemptNumber) => {
  console.log('重连成功，尝试次数:', attemptNumber);
  // 注意：reconnect 事件在 connect 之后触发
});